import model from '@/models/homeModel'
// 异步
// 初始化swiper数据
export const initSwiper = () => async (dispatch) => {
  let ret = await model.getSwiperData()
  // console.log( ret.data.data )
  // 根据数据结构dispatch
  dispatch({
    type: 'initSwiper',
    // 普通js对象
    data: ret.data
  })
}

//请求列表数据
export const setHomeListData = (params) => async (dispatch) =>{
  let {data} = await model.getHomeListrData(params);
  
  dispatch({
    type: 'setHomeListData',
    data
  })
}
// 清空列表数据
export const clearData = (arg) => async (dispatch) =>{
  dispatch({
    type: 'clearData',
    data:[]
  })
}
